package com.qf.t1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

/*
杨威
2021/9/3
17:46
*/
public class TestInserte {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/schools?useSSL=false&characterEncoding=utf-8", "root", "1234");
        Statement statement = connection.createStatement();
        int i = statement.executeUpdate("insert into student(stu_name, stu_gender, stu_phone,bornDate, stu_email, stu_address, grade_id) VALUES\n" +
                "('dahai',default,'15600011654','2000-06-04','gavin@163.com','北京市昌平区',2)");
        if(i>0){
            System.out.println("新增成功");
        } else{
            System.out.println("失败");
        }
        statement.close();
        connection.close();
    }
}
